home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_asm / morse / morse.asm next >
Encoding:
Assembly Source File  |  1986-10-31  |  33.9 KB  |  2,060 lines

  1. ;************************* EQUATES **************************
  2. sc    =    2    ;these are values to
  3. rl    =    3    ;initialize
  4. mode    =    3    ;the timer chip
  5. bcd    =    0
  6. cnword    =    sc*40h + rl*10h +mode*2 + bcd
  7. on    =    1
  8. off    =    0
  9. s_port    =    3fch    ;this is the address of modem control port
  10. rt    =    4dh    ;the following are self explanitory
  11. lft    =    4bh
  12. up    =    48h
  13. dn    =    50h
  14. cr    =    0dh
  15. tab    =    09h
  16. bs    =    08h
  17. esc    =    1bh
  18. pgup    =    49h
  19. pgdn    =    51h
  20. del    =    53h
  21. codes    segment para 'code'
  22. assume cs:codes,ds:codes,es:codes
  23.     org    100h
  24. start:    jmp    begin
  25. factor    db    0ffh    ;00  for 4.77 machines or ff for fast machines
  26. time    dw    3000h    ;these are the initial constants for timing
  27. s_time    dw    3000h    ;This one is for space timing
  28.             ;At slower speeds spaces are increased more
  29.             ;to leave characters sounding normal.
  30. wt_val    dw    3    ;Initial normal weight value 3 x dit length
  31. ;
  32. abort    dw    ?    ;This is for bail out of deep nest.
  33. sound    db    on
  34. key    db    off    ;flag for keying feature
  35. ;
  36. row    db    13
  37. col    db    10
  38. temp    db    ?
  39. corner    dw    0
  40. buff    db    3000 dup(?)
  41.  
  42. cd_key    record    hi:8,lo:4    ;8 hi bits for code, lo 4 for number
  43.                 ;of elements.
  44. ;
  45. ;    THIS IS A TABLE FOR NUMBERS AND LETTERS
  46. ;
  47. table    cd_key    <11111b,5>    ;    0
  48.     cd_key    <11110b,5>    ;    1
  49.     cd_key    <11100b,5>    ;    2
  50.     cd_key    <11000b,5>    ;    3
  51.     cd_key    <10000b,5>    ;    4
  52.     cd_key    <00000b,5>    ;    5
  53.     cd_key    <00001b,5>    ;    6
  54.     cd_key    <00011b,5>    ;    7
  55.     cd_key    <00111b,5>    ;    8
  56.     cd_key    <01111b,5>    ;    9
  57.     cd_key    <00010b,2>    ;    A
  58.     cd_key    <00001b,4>    ;    B
  59.     cd_key    <00101b,4>    ;    C
  60.     cd_key    <00001b,3>    ;    D
  61.     cd_key    <00000b,1>    ;    E
  62.     cd_key    <4,4>    ;    F
  63.     cd_key    <3,3>    ;    G
  64.     cd_key    <0,4>    ;    H
  65.     cd_key    <0,2>    ;    I
  66.     cd_key    <14,4>    ;    J
  67.     cd_key    <5,3>    ;    K
  68.     cd_key    <2,4>    ;    L
  69.     cd_key    <3,2>    ;    M
  70.     cd_key    <1,2>    ;    N
  71.     cd_key    <7,3>    ;    O    
  72.     cd_key    <6,4>    ;    P
  73.     cd_key    <11,4>    ;    Q
  74.     cd_key    <2,3>    ;    R
  75.     cd_key    <0,3>    ;    S
  76.     cd_key    <1,1>    ;    T
  77.     cd_key    <4,3>    ;    U
  78.     cd_key    <8,4>    ;    V
  79.     cd_key    <6,3>    ;    W
  80.     cd_key    <9,4>    ;    X
  81.     cd_key    <13,4>    ;    Y
  82.     cd_key    <3,4>    ;    Z
  83.     cd_key    <12,6>    ;    ?
  84.     cd_key    <51,6>    ;    ,
  85.     cd_key    <42,6>    ;    .
  86.     cd_key    <9,5>    ;    /
  87.     cd_key    <0,8>    ;    *    (used for mistake)
  88.     cd_key    <40,6>    ;    ;    (used for sk)
  89.  
  90. ;
  91. ;    END OF TABLE
  92. ;
  93. mess1    db    'WB8BIL CODE GENERATOR','$'
  94. mess2    db    'Written by:','$'
  95. mess3    db    'Gregg C.Anderson','$'
  96. mess4    db    '247 Hill St.','$'
  97. mess5    db    'Ishpeming, Mi. 49849','$'
  98. mess6    db    'Copyright (c) 1985, Gregg Anderson, All rights reserved.','$'
  99. choice1    db    '1 - SET SPEED','$'
  100. choice2    db    '2 - SET WEIGHT','$'
  101. choice3    db    '3 - START','$'
  102. choice4    db    '4 - BUFFER FUNCTIONS','$'
  103. choice5    db    '5 - KEY OUTPUT','$'
  104. choice6    db    '6 - SCRATCH PAD','$'
  105. choice7    db    '7 - QUIT','$'
  106. wt_mess    db    '1 - NORMAL     2 - HEAVY','$'
  107. s_mess1    db    'SELECT THE DESIRED SPEED','$'
  108.  
  109. s_mess2        db    '1 - SLOWEST','$'
  110. s_mess3        db    '2','$'
  111. s_mess4        db    '3 - SLOW','$'
  112. s_mess5        db    '4','$'
  113. s_mess6        db    '5 - MEDIUM','$'
  114. s_mess7        db    '6','$'
  115. s_mess8        db    '7 - FAST','$'
  116. s_mess9        db    '8','$'
  117. s_mess10    db    '9 - FASTEST','$'
  118.  
  119. k_mess1        db    'KEY OUTPUT MENU','$'
  120. k_mess2        db    '1 - KEY WITH SOUND','$'
  121. k_mess3        db    '2 - KEY WITHOUT SOUND','$'
  122. k_mess4        db    '3 - SOUND WITHOUT KEYING','$'
  123. b_mess1    db    'BUFFERED OPERATIONS MENU','$'
  124. b_mess2    db    '1 - LOAD A BUFFER','$'
  125. b_mess3    db    '2 - SEND A BUFFER','$'
  126. b_mess4 db    '3 - LOAD BUFFERS FROM DISK','$'
  127. b_mess5    db    '4 - SAVE BUFFERS ON DISK','$'
  128. b_mess9    db    '5 - PRACTICE ASCII FILE','$'
  129. b_mess6    db    '6 - RETURN TO MAIN MENU','$'
  130. b_mess7 db    'Choose A Buffer F-1 to F-10','$'
  131. b_mess8    db    'Enter Desired Text (End With A Carriage Return)','$'
  132. esc1    db    'Esc for Menu$'
  133. ;
  134. buffer    struc            ;structure to allocate buffers
  135. max    db    0feh        ;max of 254 characters
  136. act    db    ?        ;actual number gets placed here
  137. msg    db    0feh dup(0dh)    ;this is the space for characters
  138. buffer    ends
  139. ;
  140. one    buffer    <,,>    ;first of 10 buffers
  141. two    buffer    <,,>    
  142. three    buffer    <,,>    
  143. four    buffer    <,,>    
  144. five    buffer    <,,>    
  145. six    buffer    <,,>    
  146. seven    buffer    <,,>    
  147. eight    buffer    <,,>    
  148. nine    buffer    <,,>    
  149. ten    buffer    <,,>    
  150.     db    1ah
  151. ;
  152. fcb    db    00        ;The following sets up fcb for reading 
  153. fname    db    'codebuff'    ;and writing the buffer file.
  154. ext    db    'dat'
  155. block    dw    0000
  156.     dw    ?
  157.     dd    ?
  158.     dw    ?
  159.     db    10 dup(?)
  160. rec_num    db    00
  161.     dw    2 dup($)
  162. dta    db    80h dup(?)
  163.  
  164. cur_rec    db    00
  165. w_top    db    201        ;following sets up the graphics for windows
  166.     db    65 dup(205)
  167.     db    187,'$'
  168. w_sides    db    186
  169. w_bottom    db    200
  170.         db    65 dup(205)
  171.         db    188,'$'
  172. ;
  173. box_top        db    201
  174.         db    31 dup(205)
  175.         db    187,'$'
  176. box_sides    db    186
  177.         db    31 dup(32)
  178.         db    186,'$'
  179. box_bottom    db    200
  180.         db    31 dup(205)
  181.         db    188,'$'
  182. in_ptr        dw    ?
  183. out_ptr        dw    ?
  184. big_buf        dw    256 dup(?)    ;Buffer for type ahead
  185. pract_num    dw    1 dup(?)
  186. pname    db    'Enter file path\name: ','$'
  187. pname2    db    50
  188. pn_len    db    ?
  189. pr_n        db    51 dup(?)
  190. handle    dw    1 dup(?)
  191. o_err    db    'Cannot open the file','$'
  192. r_err    db    'Read failed','$'
  193. fail        db    ?
  194. ;------------------------------------------------------------
  195. begin    proc    near
  196.     mov    ax,sp
  197.     mov    abort,ax    ;set the bailout for stack pointer.
  198.     cmp    factor,00    ;check for fast machine
  199.     je    over2
  200.     mov    ax,time
  201.     shl    ax,1
  202.     mov    time,ax
  203.     mov    ax,s_time
  204.     shl    ax,1
  205.     mov    s_time,ax
  206. over2:    call    cls
  207. ;
  208.     call    boxit
  209.     call    set_dta    
  210. over:    
  211.     call    cls_b
  212.     mov    in_ptr,0
  213.     mov    out_ptr,0
  214.     call    menu
  215.     call    t_init
  216.     call    t_set
  217.     call    cls_b
  218. ;
  219. ;the following sets the "esc for menu" mess in reverse video.
  220. ;
  221.     call    esd
  222. ;
  223.     mov    ah,02    ;set cursor
  224.     mov    bh,00    ;page 0
  225.     mov    dh,13    ;row 13
  226.     mov    dl,00    ;column 0
  227.     int    10h
  228.  
  229. ;
  230. ;    HERE BEGINS THE ACTUAL CONVERSION FROM ASCII
  231. ;
  232. getkey:
  233.     mov    ah,1
  234.     int    16h
  235.     jz    no_hit
  236.     mov    ah,0
  237.     int    16h
  238.     cmp    al,esc
  239.     je    over
  240.     cmp    al,bs    ;This is test
  241.     jne    not_bk    ;This is test
  242.     mov    bx,out_ptr
  243.     cmp    bx,in_ptr
  244.     je    getkey
  245.     dec    in_ptr    ;This is test
  246.     dec    in_ptr    ;This is test
  247.     jmp    getkey    ;This is test
  248. not_bk:
  249.     mov    bx,in_ptr
  250.     mov    big_buf[bx],ax
  251.     inc    bx
  252.     inc    bx
  253.     cmp    bx,512
  254.     jle    not_full
  255.     mov    ax,0
  256. not_full:
  257.     mov    in_ptr,bx
  258. no_hit:    mov    bx,out_ptr
  259.     cmp    bx,in_ptr
  260.     je    getkey
  261.     mov    ax,big_buf[bx]
  262.     inc    bx
  263.     inc    bx
  264.     cmp    bx,512
  265.     jle    not_full2
  266.     mov    bx,0
  267. not_full2:
  268.     mov    out_ptr,bx
  269.     cmp    ah,3bh
  270.     jl    not_f
  271.     cmp    ah,44h
  272.     jg    not_f
  273.     call    b_line
  274.     jmp    getkey
  275. not_f:
  276.     call    putchar
  277.     call    screen    ;no - call routine to check for valid character.
  278.     jmp    getkey    ;do it again
  279. a_done:    call    cls
  280.     ret
  281. begin    endp
  282. ;------------------------------------------------------------
  283. t_init    proc
  284.     mov    al,cnword    ;initialize timer chip
  285.     out    43h,al
  286.     ret
  287. t_init    endp
  288. ;------------------------------------------------------------
  289. esd    proc
  290.     mov    ax,0600h    ;scroll
  291.     mov    bh,70h        ;reverse attribute
  292.     mov    cx,0b21h    ;row 11,column 33
  293.     mov    dx,0b2eh    ;to row 11,column 46
  294.     int    10h
  295. ;
  296.     mov    ah,02    ;set cursor
  297.     mov    bh,00    ;page 0
  298.     mov    dh,11    ;row 11
  299.     mov    dl,34    ;column 0
  300.     int    10h
  301. ;
  302.     
  303.     lea    dx,esc1    ;Esc to get menu
  304.     mov    ah,09
  305.     int    21h
  306.     ret
  307. esd    endp
  308. ;------------------------------------------------------------
  309. t_set    proc
  310.     mov    ax,1300        ;set tone to approx 1000hz
  311.     out    42h,al
  312.     mov    al,ah
  313.     out    42h,al
  314.     ret
  315. t_set    endp
  316. ;------------------------------------------------------------
  317. dit    proc        ;dit procedure
  318.     push    dx
  319.     push    cx
  320.     push    bx
  321.     push    ax
  322.     mov    cx,time    ;number of loops for sound on
  323.     call    make    ;routine to turn on sound
  324. dit_ct:
  325.     loop    dit_ct
  326.     call    unmake    ;routine to turn off sound
  327.     call    build
  328.     mov    cx,time    ;number of loops for space between dits
  329. spc_ct:
  330.     loop    spc_ct
  331.     pop    ax
  332.     pop    bx
  333.     pop    cx
  334.     pop    dx
  335.     ret
  336. dit    endp
  337. ;------------------------------------------------------------
  338. dah    proc
  339.     push    dx
  340.     push    cx
  341.     push    bx
  342.     push    ax
  343.     mov    cx,wt_val    ;set the length of dah's
  344.                 ;wt_val * length of dit
  345. next:
  346.     push    cx
  347.     mov    cx,time        ;length of dit
  348.     call    make
  349. dah_ct:
  350.     loop    dah_ct
  351.     pop    cx
  352.     dec    cx
  353.     jnz    next
  354.     call    unmake
  355.     call    build
  356.     mov    cx,time    ;time for space between dah and next element
  357. spc:    
  358.     loop    spc
  359.     pop    ax
  360.     pop    bx
  361.     pop    cx
  362.     pop    dx
  363.     ret
  364. dah    endp
  365. ;------------------------------------------------------------
  366. serial    dw    0ffffh    ;This was spot for serial no. when prog was to be sold
  367. ;------------------------------------------------------------
  368. make    proc
  369.     cmp    sound,on
  370.     jne    make2
  371.     call    snd_on
  372. make2:    cmp    key,on
  373.     jne    make3
  374.     call    key_on
  375. make3:    ret
  376. make    endp
  377. ;------------------------------------------------------------
  378. unmake    proc
  379.     cmp    sound,on
  380.     jne    unmak2
  381.     call    snd_off
  382. unmak2:    cmp    key,on
  383.     jne    unmak3
  384.     call    key_off
  385. unmak3:    ret
  386. unmake    endp
  387. ;------------------------------------------------------------
  388. snd_on    proc        ;procedure to turn on the sound
  389.     in    al,61h
  390.     or    al,3
  391.     out    61h,al
  392.     ret
  393. snd_on    endp
  394. ;------------------------------------------------------------
  395. snd_off    proc        ;procedure to turn off the sound
  396.     in    al,61h
  397.     and    al,0fch
  398.     out    61h,al
  399.     ret
  400. snd_off    endp
  401. ;------------------------------------------------------------
  402. key_on    proc        ;procedure to turn on the DTR
  403.     push    dx
  404.     mov    dx,s_port    ;load dx with adr of modem cntrl port
  405.     in    al,dx
  406.     or    al,01h        ;turn on the least bit
  407.     out    dx,al
  408.     pop    dx
  409.     ret
  410. key_on    endp
  411. ;------------------------------------------------------------
  412. key_off    proc        ;procedure to turn off the DTR
  413.     push    dx
  414.     mov    dx,s_port
  415.     in    al,dx
  416.     and    al,0feh        ;turn off the first bit
  417.     out    dx,al
  418.     pop    dx
  419.     ret
  420. key_off    endp
  421. ;------------------------------------------------------------
  422. space    proc        ;this is the procedure for spacing
  423.             ;between characters. 
  424.     push    cx
  425.     mov    cx,4
  426. do:
  427.     push    cx
  428.     mov    cx,s_time    ;basic space timing element
  429.                 ;note that s_time is greater than
  430.                 ;time at low speeds to keep char
  431.                 ;sounding normal.
  432. down:
  433.     loop    down
  434.     pop    cx
  435.     dec    cx
  436.     jnz    do
  437.     pop    cx
  438.     ret
  439. space    endp
  440. ;------------------------------------------------------------
  441. screen     proc        ;routine to check for valid input
  442.     cmp    al,'?'
  443.     je    huh
  444.     cmp    al,','
  445.     je    comma
  446.     cmp    al,'.'
  447.     je    period
  448.     cmp    al,'/'
  449.     je    slash
  450.     cmp    al,' '
  451.     je    space2
  452.     cmp    al,'*'    ;* is char used for 8 dits for mistake.
  453.     je    oops
  454.     cmp    al,';'
  455.     je    sk
  456.     cmp     al,48    ;is it less than a zero?
  457.     jl    bad
  458.     cmp    al,57    ;is it less than or equal to a 9?
  459.     jle    number
  460.     cmp    al,65    ;is it less than a upper case A?
  461.     jl    bad
  462.     cmp    al,90    ;is it less or equal to Z?
  463.     jle    alpha
  464.     cmp    al,97    ;is it less than a lower case a?
  465.     jl    bad
  466.     cmp    al,122    ;is it less or equal to z?
  467.     jle    lwr_al
  468.     jmp    bad
  469. huh:    mov    bx,72
  470.     call    decode    ;call to decode a valid character
  471.     jmp    bad
  472. comma:    mov    bx,74
  473.     call    decode
  474.     jmp    bad
  475. period:    mov    bx,76
  476.     call    decode
  477.     jmp    bad
  478. slash:    mov    bx,78
  479.     call    decode
  480.     jmp    bad
  481. oops:    mov    bx,80
  482.     call    decode
  483.     jmp    bad
  484. sk:    mov    bx,82
  485.     call    decode
  486.     jmp    bad
  487. number:    sub    al,30h    ;convert number to relative position in table.
  488.     mov    ah,0
  489.     shl    ax,1    ;multiply by 2 to get word position
  490.     mov    bx,ax
  491.     call    decode
  492.     jmp    bad
  493. lwr_al:    sub    al,32    ;make lower case letters upper case for
  494.             ;table referencing.
  495.             ;
  496. alpha:    sub    al,55    ;convert letter to relative position in table.
  497.     mov    ah,0
  498.     shl    ax,1
  499.     mov    bx,ax
  500.     call    decode
  501.     jmp    bad
  502. space2:    call    sp_bar
  503. bad:    ret
  504. screen    endp
  505. ;------------------------------------------------------------
  506. decode    proc
  507.     mov    ax,table[bx]    ;move the value at the bx'th
  508.                 ;element of the table int ax register.
  509.     mov    dx,ax
  510.     and    dx,mask lo    ;make dx contain number of elements
  511.     mov    cl,hi        ;put bit offset of code portion
  512.                 ;into cl
  513.     shr    ax,cl        ;position code at right end of word.
  514.     mov    cx,dx        ;move element count into cx
  515. do_it:
  516.     test    ax,1        ;test first bit for dah
  517.     jz    dt_call        ;no jump to dit routine.
  518.     call    dah        
  519.     jmp    finish
  520. dt_call:
  521.     call    dit
  522. finish:
  523.     shr    ax,1        ;move next bit into position
  524.     loop    do_it    
  525.     call    space        ;call to space between char routine
  526.     ret
  527. decode    endp
  528. ;------------------------------------------------------------
  529. sp_bar    proc        ;procedure for space between words
  530.     push    cx
  531.     mov    cx,2
  532. s_agn:    
  533.     push    cx
  534.     mov    cx,4
  535. d025:
  536.     push    cx
  537.     mov    cx,time    ;basic space timing element
  538.                 ;note that s_time is greater than
  539.                 ;time at low speeds to keep char
  540.                 ;sounding normal.
  541. down20:
  542.     loop    down20
  543.     pop    cx
  544.     dec    cx
  545.     jnz    d025
  546.     pop    cx
  547.  
  548.     loop    s_agn
  549.     pop    cx
  550.     ret
  551. sp_bar    endp
  552. ;------------------------------------------------------------
  553. menu    proc    ;initial main menu routine
  554. mnu:
  555. ;
  556.     call    heading
  557.     mov    ah,02
  558.     mov    bh,00
  559.     mov    dh,11
  560.     mov    dl,15
  561.     int    10h
  562. ;
  563.     lea    dx,choice1    ;SET SPEED
  564.     mov    ah,09
  565.     int    21h
  566. ;
  567.     mov    ah,02
  568.     mov    bh,00
  569.     mov    dh,13
  570.     mov    dl,15
  571.     int    10h
  572. ;
  573.     lea    dx,choice2    ;SET WEIGHT
  574.     mov    ah,09
  575.     int    21h
  576. ;
  577.     mov    ah,02
  578.     mov    bh,00
  579.     mov    dh,15
  580.     mov    dl,15
  581.     int    10h
  582. ;
  583.     lea    dx,choice3    ;START
  584.     mov    ah,09
  585.     int    21h
  586. ;
  587.     mov    ah,02
  588.     mov    bh,00
  589.     mov    dh,17
  590.     mov    dl,15
  591.     int    10h
  592. ;
  593.     lea    dx,choice4    ;BUFFER FUNCTIONS
  594.     mov    ah,09
  595.     int    21h
  596. ;
  597.     mov    ah,02
  598.     mov    bh,00
  599.     mov    dh,19
  600.     mov    dl,15
  601.     int    10h
  602. ;
  603.     lea    dx,choice5    ;KEY OUTPUT
  604.     mov    ah,09
  605.     int    21h
  606. ;
  607.     mov    ah,02
  608.     mov    bh,00
  609.     mov    dh,21
  610.     mov    dl,15
  611.     int    10h
  612. ;
  613.     lea    dx,choice6    ;SCRATCH PAD
  614.     mov    ah,09
  615.     int    21h
  616. ;
  617.     mov    ah,02
  618.     mov    bh,00
  619.     mov    dh,23
  620.     mov    dl,15
  621.     int    10h
  622. ;
  623.     lea    dx,choice7    ;QUIT
  624.     mov    ah,09
  625.     int    21h
  626. ;
  627.     mov    ah,02
  628.     mov    bh,00
  629.     mov    dh,24
  630.     mov    dl,15
  631.     int    10h
  632.  
  633.     call    select    ;call routine for selecting the op desired
  634.     call    cls_b
  635.     jmp    mnu
  636.     ret
  637. menu    endp    
  638. ;------------------------------------------------------------
  639. cls    proc            ;Clear Screen Procedure
  640.     mov    ax,0600h    ;scroll
  641.     mov    bh,07        ;normal attribute
  642.     mov    cx,0000        ;row 0,column 0
  643.     mov    dx,184fh    ;to row 18h,column 4fh (24,79)
  644.     int    10h
  645.     ret
  646. cls    endp
  647. ;------------------------------------------------------------
  648. cls_b    proc            ;Clear Bottom of Screen Procedure 
  649.     mov    ax,0600h    ;scroll
  650.     mov    bh,07        ;normal attribute
  651.     mov    cx,0b00h    ;row 11,column 0
  652.     mov    dx,184fh    ;to row 18h,column 4fh (24,79)
  653.     int    10h
  654.     ret
  655. cls_b    endp
  656. ;------------------------------------------------------------
  657. cls_w    proc        
  658.     mov    ax,0600h
  659.     mov    bh,07    
  660.     mov    ch,13
  661.     mov    cl,10
  662.     mov    dh,22    
  663.     mov    dl,69
  664.     int    10h
  665.     ret
  666. cls_w    endp
  667. ;------------------------------------------------------------
  668. select    proc            ;Routine for making menu selections
  669. wrong:    mov    ah,00        ;input character with no echo
  670.     int    16h    
  671.     cmp    al,30h        ;check for value between ascii 0
  672.     jle    wrong
  673.     cmp    al,37h        ;and ascii 6
  674.     jg    wrong
  675.     cmp    al,31h
  676.     je    spd
  677.     cmp    al,32h
  678.     je    wt
  679.     cmp    al,33h
  680.     je    go
  681.     cmp    al,34h
  682.     je    buf_op
  683.     cmp    al,35h
  684.     je    key_c
  685.     cmp    al,36h
  686.     je     pad
  687.     mov    ax,abort
  688.     mov    sp,ax
  689.     jmp    a_done
  690. pad:    call  s_pad
  691.     ret
  692. spd:    call    speed        ;call to speed setting routine
  693.     ret
  694. wt:    call    weight        ;call to weight setting routine
  695.     ret
  696. go:    pop    ax
  697.     ret
  698. buf_op:    call    cls_b
  699.     call    b_menu        ;call for buffer menu routine
  700.     ret
  701. key_c:    call    cls_b
  702.     call    key_menu
  703.     ret
  704. select    endp
  705. ;------------------------------------------------------------
  706. key_menu    proc
  707.     call    cls_b
  708.     mov    ah,02    ;Set cursor
  709.     mov    bh,00    ;page 0
  710.     mov    dh,11    ;row 11
  711.     mov    dl,32    ;column 32
  712.     int    10h    
  713.  
  714.     lea    dx,k_mess1        ;KEY OUTPUT MENU
  715.     mov    ah,09
  716.     int    21h
  717.  
  718. ;
  719.     mov     ah,02
  720.     mov    bh,00
  721.     mov    dh,14
  722.     mov    dl,20
  723.     int    10h
  724. ;
  725.     lea    dx,k_mess2    ;1 - KEY WITH SOUND
  726.     mov    ah,09
  727.     int    21h
  728. ;
  729.     mov    ah,02
  730.     mov    bh,00
  731.     mov    dh,16
  732.     mov    dl,20
  733.     int    10h
  734. ;
  735.     lea    dx,k_mess3    ;2 - KEY WITHOUT SOUND
  736.     mov    ah,09
  737.     int    21h
  738. ;
  739.     mov    ah,02
  740.     mov    bh,00
  741.     mov    dh,18
  742.     mov    dl,20
  743.     int    10h
  744. ;
  745.     lea    dx,k_mess4    ;3 - SOUND WITHOUT KEYING
  746.     mov    ah,09
  747.     int    21h        
  748.     call    k_sel
  749.     ret
  750. key_menu    endp
  751. ;------------------------------------------------------------
  752. k_sel    proc
  753. k_wr2:    mov    ah,00
  754.     int    16h    
  755.     cmp    al,30h
  756.     jle    k_wr2
  757.     cmp    al,33h
  758.     jg    k_wr2
  759.     cmp    al,31h
  760.     je    k_s
  761.     cmp    al,32h
  762.     je    k_ns
  763.     mov    sound,on
  764.     mov    key,off
  765.     ret
  766. k_s:    mov    sound,on
  767.     mov    key,on
  768.     ret
  769. k_ns:    mov    sound,off
  770.     mov    key,on
  771.     ret
  772. k_sel    endp
  773. ;------------------------------------------------------------
  774. b_menu    proc
  775.     call    t_init
  776.     call    t_set
  777. st_b:    call    cls_b
  778.     mov    ah,02    ;set cursor
  779.     mov    bh,00    ;page 0
  780.     mov    dh,11    ;row 11
  781.     mov    dl,27    ;column 27
  782.     int    10h
  783. ;    
  784.     lea    dx,b_mess1    ;BUFFERED OPERATIONS MENU
  785.     mov    ah,09
  786.     int    21h
  787. ;
  788.     mov     ah,02
  789.     mov    bh,00
  790.     mov    dh,13
  791.     mov    dl,20
  792.     int    10h
  793. ;
  794.     lea    dx,b_mess2    ;1 - LOAD A BUFFER 
  795.     mov    ah,09
  796.     int    21h
  797. ;
  798.     mov    ah,02
  799.     mov    bh,00
  800.     mov    dh,15
  801.     mov    dl,20
  802.     int    10h
  803. ;
  804.     lea    dx,b_mess3    ;2 - SEND A BUFFER
  805.     mov    ah,09
  806.     int    21h
  807. ;
  808.     mov    ah,02
  809.     mov    bh,00
  810.     mov    dh,17
  811.     mov    dl,20
  812.     int    10h
  813.  
  814.     lea    dx,b_mess4    ;3 - LOAD BUFFERS FROM DISK
  815.     mov    ah,09
  816.     int    21h
  817. ;
  818.     mov    ah,02
  819.     mov    bh,00
  820.     mov    dh,19
  821.     mov    dl,20
  822.     int    10h
  823.  
  824.     lea    dx,b_mess5    ;4 - SAVE BUFFERS ON DISK
  825.     mov    ah,09
  826.     int    21h
  827. ;
  828.     mov    ah,02
  829.     mov    bh,00
  830.     mov    dh,21
  831.     mov    dl,20
  832.     int    10h
  833. ;
  834.     lea    dx,b_mess9    ;5 - LOAD PRACTICE FILE
  835.     mov    ah,09
  836.     int    21h
  837. ;
  838.     mov    ah,02
  839.     mov    bh,00
  840.     mov    dh,23
  841.     mov    dl,20
  842.     int    10h
  843. ;
  844.     lea    dx,b_mess6    ;6 - RETURN TO MAIN MENU
  845.     mov    ah,09
  846.     int    21h        
  847. ;
  848.     mov    ah,02
  849.     mov    bh,00
  850.     mov    dh,24
  851.     mov    dl,20
  852.     int    10h
  853. ;
  854.     call    buf_sel        ;call for selecting from buff menu
  855.     jmp    st_b
  856.     ret
  857. b_menu    endp
  858. ;------------------------------------------------------------
  859. speed    proc        ;routine for speed menu
  860.             ;and setting of speeds
  861.     call    cls_b
  862.     mov    ah,02    ;set cursor
  863.     mov    bh,00    ;page 0
  864.     mov    dh,11    ;row 11
  865.     mov    dl,27    ;column 27
  866.     int    10h
  867. ;    
  868.     lea    dx,s_mess1    ;SELECT THE DESIRED SPEED
  869.     mov    ah,09
  870.     int    21h
  871. ;
  872.     mov    ah,02
  873.     mov    bh,00
  874.     mov    dh,13
  875.     mov    dl,20
  876.     int    10h
  877. ;
  878.     lea    dx,s_mess2
  879.     mov    ah,09
  880.     int    21h
  881. ;
  882.     mov    ah,02
  883.     mov    bh,00
  884.     mov    dh,14
  885.     mov    dl,20
  886.     int    10h
  887. ;
  888.     lea    dx,s_mess3
  889.     mov    ah,09
  890.     int    21h
  891. ;
  892.     mov    ah,02
  893.     mov    bh,00
  894.     mov    dh,15
  895.     mov    dl,20
  896.     int    10h
  897. ;
  898.     lea    dx,s_mess4
  899.     mov    ah,09
  900.     int    21h
  901. ;
  902.     mov    ah,02
  903.     mov    bh,00
  904.     mov    dh,16
  905.     mov    dl,20
  906.     int    10h
  907. ;
  908.     lea    dx,s_mess5
  909.     mov    ah,09
  910.     int    21h
  911. ;
  912.     mov    ah,02
  913.     mov    bh,00
  914.     mov    dh,17
  915.     mov    dl,20
  916.     int    10h
  917. ;
  918.     lea    dx,s_mess6
  919.     mov    ah,09
  920.     int    21h        
  921. ;
  922.     mov    ah,02
  923.     mov    bh,00
  924.     mov    dh,18
  925.     mov    dl,20
  926.     int    10h
  927. ;
  928.     lea    dx,s_mess7
  929.     mov    ah,09
  930.     int    21h
  931. ;
  932.     mov    ah,02
  933.     mov    bh,00
  934.     mov    dh,19
  935.     mov    dl,20
  936.     int    10h
  937. ;
  938.     lea    dx,s_mess8
  939.     mov    ah,09
  940.     int    21h        
  941. ;
  942.     mov    ah,02
  943.     mov    bh,00
  944.     mov    dh,20
  945.     mov    dl,20
  946.     int    10h
  947. ;
  948.     lea    dx,s_mess9
  949.     mov    ah,09
  950.     int    21h
  951. ;
  952.     mov    ah,02
  953.     mov    bh,00
  954.     mov    dh,21
  955.     mov    dl,20
  956.     int    10h
  957. ;
  958.     lea    dx,s_mess10
  959.     mov    ah,09
  960.     int    21h        
  961. ;
  962. wrong2:    mov    ah,00
  963.     int    16h    
  964.     cmp    al,30h
  965.     jle    wrong2
  966.     cmp    al,39h
  967.     jg    wrong2
  968.     cmp    al,31h
  969.     je    sloest
  970.     cmp    al,32h
  971.     je    s_2
  972.     cmp    al,33h
  973.     je    slow
  974.     cmp    al,34h
  975.     je    s_4
  976.     cmp    al,35h
  977.     je    medium
  978.     cmp    al,36h
  979.     je    s_6
  980.     cmp    al,37h
  981.     je    fast
  982.     cmp    al,38h
  983.     je    s_8
  984.     mov    time,2300h
  985.     mov    s_time,2300h
  986.     jmp    xx1
  987. sloest:    mov    s_time,6800h
  988.     mov    time,3800h
  989.     jmp    xx1
  990. s_2:    mov    s_time,6000h
  991.     mov    time,3400h
  992.     jmp    xx1
  993. slow:    mov    s_time,5000h
  994.     mov    time,3000h
  995.     jmp    xx1
  996. s_4:    mov    s_time,4000h
  997.     mov    time,3000h
  998.     jmp    xx1
  999. medium:    mov    s_time,3000h
  1000.     mov    time,3000h
  1001.     jmp    xx1
  1002. s_6:    mov    time,2800h
  1003.     mov    s_time,2800h
  1004.     jmp    xx1
  1005. fast:    mov    time,2600h
  1006.     mov    s_time,2600h
  1007.     jmp    xx1
  1008. s_8:    mov    time,2400h
  1009.     mov    s_time,2400h
  1010. xx1:    mov    ah,factor
  1011.     cmp    ah,00
  1012.     je    xx2
  1013.     mov    ax,time
  1014.     shl    ax,1
  1015.     mov    time,ax
  1016.     mov    ax,s_time
  1017.     shl    ax,1
  1018.     mov    s_time,ax
  1019. xx2:    ret
  1020. speed    endp
  1021. ;------------------------------------------------------------    
  1022. weight    proc        ;routine for setting wt_val
  1023.     mov    ah,02    ;set cursor
  1024.     mov    bh,00    ;page 0
  1025.     mov    dh,24    ;row 24
  1026.     mov    dl,10    ;column 10
  1027.     int    10h
  1028. ;    
  1029.     lea    dx,wt_mess    ;1 - NORMAL      2 - HEAVY
  1030.     mov    ah,09
  1031.     int    21h
  1032. wrong3:    mov    ah,00
  1033.     int    16h    
  1034.     cmp    al,31h
  1035.     je    nml
  1036.     cmp    al,32h
  1037.     jne    wrong3
  1038.     mov    wt_val,04
  1039.     ret
  1040. nml:    mov    wt_val,03
  1041.     ret    
  1042. weight    endp
  1043. ;------------------------------------------------------------
  1044. buf_sel    proc            ;routine for making selections
  1045.                 ;from buff menu
  1046. no_gd:    mov    ah,00
  1047.     int    16h
  1048.     cmp    al,30h
  1049.     jle    no_gd
  1050.     cmp    al,37h
  1051.     jge    no_gd
  1052.     cmp    al,33h
  1053.     je    r_disk
  1054.     cmp    al,34h
  1055.     je    w_disk
  1056.     cmp    al,31h
  1057.     je    b_load
  1058.     cmp    al,35h
  1059.     je    file_r
  1060.     cmp    al,32h
  1061.     jne    n_send
  1062.     jmp    b_send
  1063. n_send:    pop    ax
  1064.     ret
  1065. r_disk:
  1066.     call    dtb
  1067.     ret
  1068. file_r:
  1069.     call    practice
  1070.     ret
  1071. w_disk:    
  1072.     call    create
  1073.     call    btd
  1074.     ret
  1075. b_load:    call    cls_b
  1076.     mov    ah,02    ;set cursor
  1077.     mov    bh,00    ;page 0
  1078.     mov    dh,11    ;row 11
  1079.     mov    dl,26    ;column 26
  1080.     int    10h
  1081.     lea    dx,b_mess7
  1082.     mov    ah,09
  1083.     int    21h
  1084. nope:    mov    ah,0
  1085.     int    16h    ;get the scan code of key
  1086.     cmp    ah,3bh    ;is it less than F1
  1087.     jl    nope
  1088.     cmp    ah,44h    ;is it greater than F10
  1089.     jg    nope
  1090.     push    ax    ;put the scan code onto the stack
  1091.     call    cls_b
  1092.     mov    ah,02    ;set cursor
  1093.     mov    bh,00    ;page 0
  1094.     mov    dh,11    ;row 11
  1095.     mov    dl,0    ;column 0
  1096.     int    10h
  1097.     lea    dx,b_mess8
  1098.     mov    ah,09
  1099.     int    21h
  1100.     mov    ah,02    ;set cursor
  1101.     mov    bh,00    ;page 0
  1102.     mov    dh,13    ;row 13
  1103.     mov    dl,0    ;column 0
  1104.     int    10h
  1105.     pop    ax    ;pop the scan code off of the stack
  1106.     cmp    ah,3bh    ;these next cmp's find which funct key was hit
  1107.     je    first
  1108.     cmp    ah,3ch
  1109.     je    second
  1110.     cmp    ah,3dh
  1111.     je    third
  1112.     cmp    ah,3eh
  1113.     je    fourth
  1114.     cmp    ah,3fh
  1115.     je    fifth
  1116.     cmp    ah,40h
  1117.     je    sixth
  1118.     cmp    ah,41h
  1119.     je    seventh
  1120.     cmp    ah,42h
  1121.     je    eighth
  1122.     cmp    ah,43h
  1123.     je    ninth
  1124. tenth:    lea    dx,ten
  1125.     call    loader    ;call the buffer loader routine
  1126.     ret
  1127. first:    lea    dx,one
  1128.     call    loader
  1129.     ret
  1130. second:    lea    dx,two
  1131.     call    loader
  1132.     ret
  1133. third:    lea    dx,three
  1134.     call    loader
  1135.     ret
  1136. fourth:    lea    dx,four
  1137.     call    loader
  1138.     ret
  1139. fifth:    lea    dx,five
  1140.     call    loader
  1141.     ret
  1142. sixth:    lea    dx,six
  1143.     call    loader
  1144.     ret
  1145. seventh:
  1146.     lea    dx,seven
  1147.     call    loader
  1148.     ret
  1149. eighth:    lea    dx,eight
  1150.     call    loader
  1151.     ret
  1152. ninth:    lea    dx,nine
  1153.     call    loader
  1154.     ret
  1155. b_send:    call    cls_b    ;this begins the buffer send section
  1156. ;
  1157.     mov    ah,02    ;set cursor
  1158.     mov    bh,00    ;page 0
  1159.     mov    dh,11    ;row 11
  1160.     mov    dl,26    ;column 26
  1161.     int    10h
  1162. ;
  1163.     lea    dx,b_mess7
  1164.     mov    ah,09
  1165.     int    21h
  1166. nopes:    mov    ah,0
  1167.     int    16h    ;check for scan code to find funct key
  1168.     cmp    ah,3bh
  1169.     jl    nopes
  1170.     cmp    ah,44h
  1171.     jg    nopes
  1172.     push    ax
  1173.     call    cls_b
  1174.     mov    ah,02    ;set cursor
  1175.     mov    bh,00    ;page 0
  1176.     mov    dh,11    ;row 11
  1177.     mov    dl,0    ;column 0
  1178.     int    10h
  1179.     pop    ax
  1180.     cmp    ah,3bh
  1181.     je    firsts
  1182.     cmp    ah,3ch
  1183.     je    seconds
  1184.     cmp    ah,3dh
  1185.     je    thirds
  1186.     cmp    ah,3eh
  1187.     je    fourths
  1188.     cmp    ah,3fh
  1189.     je    fifths
  1190.     cmp    ah,40h
  1191.     je    sixths
  1192.     cmp    ah,41h
  1193.     je    sevenths
  1194.     cmp    ah,42h
  1195.     je    eighths
  1196.     cmp    ah,43h
  1197.     je    ninths
  1198.     lea    bx,ten[2]     ;reference the position of message in
  1199.     call    sender        ;list of buffers
  1200.     ret
  1201. firsts:    lea    bx,one[2]
  1202.     call    sender
  1203.     ret
  1204. seconds:
  1205.     lea    bx,two[2]
  1206.     call    sender
  1207.     ret
  1208. thirds:    lea    bx,three[2]
  1209.     call    sender
  1210.     ret
  1211. fourths:
  1212.     lea    bx,four[2]
  1213.     call    sender
  1214.     ret
  1215. fifths:    lea    bx,five[2]
  1216.     call    sender
  1217.     ret
  1218. sixths:    lea    bx,six[2]
  1219.     call    sender
  1220.     ret
  1221. sevenths:
  1222.     lea    bx,seven[2]
  1223.     call    sender
  1224.     ret
  1225. eighths:
  1226.     lea    bx,eight[2]
  1227.     call    sender
  1228.     ret
  1229. ninths:    lea    bx,nine[2]
  1230.     call    sender
  1231.     ret
  1232. buf_sel    endp
  1233. ;------------------------------------------------------------
  1234. loader    proc        ;load buffer routine
  1235.     mov    ax,0c0ah
  1236.     int    21h
  1237.     ret
  1238. loader    endp
  1239. ;------------------------------------------------------------
  1240. sender    proc        ;send buffer routine
  1241.     mov    al,[bx]
  1242. msg_ptr:
  1243.     call    putchar    ;call to display the sent char
  1244.     push    bx
  1245.     call    screen
  1246.     pop    bx
  1247.     inc    bx
  1248.     mov    al,[bx]
  1249.     call    esc_ch
  1250.     cmp    al,13    ;check for carriage return
  1251.     jne    msg_ptr
  1252.     ret
  1253. sender    endp
  1254. ;------------------------------------------------------------
  1255. putchar    proc        ;routine to display char sent from buffer
  1256.     push    dx
  1257.     mov    dl,al
  1258.     mov    ah,02
  1259.     int    21h
  1260.     pop    dx
  1261.     ret
  1262. putchar    endp
  1263. ;------------------------------------------------------------
  1264. set_dta    proc
  1265.     lea    dx,dta
  1266.     mov    ah,1ah
  1267.     int    21h
  1268.     ret
  1269. set_dta endp
  1270. ;------------------------------------------------------------
  1271. create    proc    
  1272.     lea    dx,fcb
  1273.     mov    ah,16h
  1274.     int    21h
  1275.     ret
  1276. create    endp
  1277. ;------------------------------------------------------------
  1278. open    proc
  1279.     lea    dx,fcb
  1280.     mov    ah,0fh
  1281.     int    21h
  1282.     ret
  1283. open    endp
  1284. ;------------------------------------------------------------
  1285. read    proc
  1286.     lea    dx,fcb
  1287.     mov    ah,14h
  1288.     int    21h
  1289.     ret
  1290. read    endp
  1291. ;------------------------------------------------------------
  1292. write    proc
  1293.     lea    dx,fcb
  1294.     mov    ah,15h
  1295.     int    21h
  1296.     ret
  1297. write    endp
  1298. ;------------------------------------------------------------
  1299. close    proc
  1300.     lea    dx,fcb
  1301.     mov    ah,10h
  1302.     int    21h
  1303.     ret
  1304. close    endp
  1305. ;------------------------------------------------------------
  1306. dtb    proc
  1307.     call    open
  1308.     cmp    al,0ffh
  1309.     je        fnt1
  1310.     lea    si,dta
  1311.     lea    di,one
  1312.     mov    cx,20
  1313. dtb1:    push    cx
  1314.     call    read
  1315.     mov    cx,80h
  1316.     rep    movsb
  1317.     pop    cx
  1318.     lea    si,dta
  1319.     loop    dtb1
  1320.     call    close
  1321.     mov    rec_num,00
  1322. fnt1:    ret
  1323. dtb    endp
  1324. ;------------------------------------------------------------
  1325. btd    proc
  1326.     call    open
  1327.     cmp    al,0ffh
  1328.     je    fnt2
  1329.     lea    di,dta
  1330.     lea    si,one
  1331.     mov    cx,20
  1332. btd1:    push    cx
  1333.     mov    cx,80h
  1334.     rep    movsb
  1335.     call    write
  1336.     pop    cx
  1337.     lea    di,dta
  1338.     loop    btd1
  1339.     call    close
  1340.     mov    rec_num,00
  1341. fnt2:    ret
  1342. btd    endp
  1343. ;------------------------------------------------------------
  1344. b_line    proc
  1345.     cmp    ah,3bh
  1346.     je    f1
  1347.     cmp    ah,3ch
  1348.     je    f2
  1349.     cmp    ah,3dh
  1350.     je    f3
  1351.     cmp    ah,3eh
  1352.     je    f4
  1353.     cmp    ah,3fh
  1354.     je    f5
  1355.     cmp    ah,40h
  1356.     je    f6
  1357.     cmp    ah,41h
  1358.     je    f7
  1359.     cmp    ah,42h
  1360.     je    f8
  1361.     cmp    ah,43h
  1362.     je    f9
  1363.     lea    bx,ten[2]     ;reference the position of message in
  1364.     call    sender        ;list of buffers
  1365.     ret
  1366. f1:    lea    bx,one[2]
  1367.     call    sender
  1368.     ret
  1369. f2:
  1370.     lea    bx,two[2]
  1371.     call    sender
  1372.     ret
  1373. f3:    lea    bx,three[2]
  1374.     call    sender
  1375.     ret
  1376. f4:
  1377.     lea    bx,four[2]
  1378.     call    sender
  1379.     ret
  1380. f5:    lea    bx,five[2]
  1381.     call    sender
  1382.     ret
  1383. f6:    lea    bx,six[2]
  1384.     call    sender
  1385.     ret
  1386. f7:
  1387.     lea    bx,seven[2]
  1388.     call    sender
  1389.     ret
  1390. f8:
  1391.     lea    bx,eight[2]
  1392.     call    sender
  1393.     ret
  1394. f9:    lea    bx,nine[2]
  1395.     call    sender
  1396.     ret
  1397. b_line    endp
  1398. ;------------------------------------------------------------
  1399. cur_top    proc
  1400.     mov    ah,02    ;set cursor
  1401.     mov    bh,00    ;page 0
  1402.     mov    dh,13    ;row 11
  1403.     mov    dl,10    ;column 0
  1404.     int    10h
  1405.     ret
  1406. cur_top    endp
  1407. ;------------------------------------------------------------
  1408. cur_bot    proc
  1409.     mov    ah,02    ;set cursor
  1410.     mov    bh,00    ;page 0
  1411.     mov    dh,22    ;row 11
  1412.     mov    dl,10    ;column 0
  1413.     int    10h
  1414.     ret
  1415. cur_bot    endp
  1416. ;------------------------------------------------------------
  1417. getchar    proc    
  1418.     mov    ah,0
  1419.     int    16h
  1420.     ret
  1421. getchar    endp
  1422. ;------------------------------------------------------------
  1423. strip    proc
  1424.     cmp    ah,up
  1425.     jne    st10
  1426.     call    c_up
  1427.     mov    ax,0
  1428.     ret
  1429. st10:    cmp    ah,dn
  1430.     jne    st20
  1431.     call    c_dn
  1432.     mov    ax,0
  1433.     ret
  1434. st20:    cmp    ah,rt
  1435.     jne    st30
  1436.     call    c_rt
  1437.     mov    ax,0
  1438.     ret
  1439. st30:    cmp    ah,lft
  1440.     jne    st40
  1441.     call    c_lt
  1442.     mov    ah,0
  1443.     ret
  1444. st40:    cmp    al,cr
  1445.     jne    st50
  1446.     call    crlf
  1447.     mov    ax,0
  1448.     ret
  1449. st50:    cmp    al,bs
  1450.     jne    st60
  1451.     call    c_bs
  1452.     mov    ax,0
  1453.     ret
  1454. st60:    cmp    al,tab
  1455.     jne    st70
  1456.     mov    ax,0
  1457.     ret
  1458. st70:    cmp    ah,pgdn
  1459.     jne    st80
  1460.     call    p_dn
  1461.     mov    ax,0
  1462.     ret
  1463. st80:    cmp    ah,pgup
  1464.     jne    st90
  1465.     call    p_up
  1466.     mov    ax,0
  1467.     ret
  1468. st90:    cmp    ah,del
  1469.     jne    st100
  1470.     call    unbuf
  1471.     mov    ax,0    
  1472. st100:    ret
  1473. strip    endp
  1474. ;------------------------------------------------------------
  1475. unbuf    proc
  1476.     mov    cx,3000
  1477.     mov    di,0
  1478. ub10:    mov    buff[di],0
  1479.     inc    di
  1480.     loop    ub10
  1481.     call    cls_w
  1482.     mov    di,0
  1483.     mov    row,13
  1484.     mov    corner,0
  1485.     mov    col,10
  1486.     call    pos_c
  1487.     mov    ax,0
  1488.     ret
  1489. unbuf    endp
  1490. ;------------------------------------------------------------
  1491. p_up    proc
  1492.     cmp    corner,540
  1493.     jle    pu10
  1494.     sub    corner,600
  1495.     mov    di,corner
  1496.     jmp    pu20
  1497. pu10:    mov    corner,0
  1498.     mov    di,0
  1499. pu20:    mov    cx,599
  1500.     mov    row,13
  1501.     mov    col,10
  1502.     call    pos_c
  1503.     mov    si,corner
  1504. pu30:    mov    al,buff[si]
  1505.     call    putch
  1506.     inc    si
  1507.     loop    pu30
  1508.     mov    di,corner
  1509.     mov    col,10
  1510.     mov    row,13
  1511.     call    pos_c
  1512.     ret
  1513. p_up    endp
  1514. ;------------------------------------------------------------
  1515. p_dn    proc
  1516.     cmp    corner,2400
  1517.     jge    pd20
  1518.     cmp    corner,1800
  1519.     jl    pd5
  1520.     call    cls_w
  1521. pd5:    add    corner,600
  1522.     mov    si,corner
  1523.     mov    di,corner
  1524.     push    di
  1525.     mov    col,10
  1526.     mov    row,13
  1527.     call    pos_c
  1528.     mov    cx,599
  1529. pd10:    mov    al,buff[si]
  1530.     call    putch
  1531.     inc    si
  1532.     cmp    si,2999
  1533.     jge    pd16
  1534. pd15:    loop    pd10
  1535. pd16:    pop    di
  1536.     mov    col,10
  1537.     mov    row,13
  1538.     call    pos_c
  1539. pd20:    ret
  1540. p_dn    endp    
  1541. ;------------------------------------------------------------
  1542. p_top    proc
  1543.     mov    cx,60
  1544.     call    cur_top
  1545.     mov    bx,corner
  1546. pt10:    mov    al,buff[bx]
  1547.     call    putchar
  1548.     inc    bx
  1549.     loop    pt10
  1550.     call    pos_c
  1551.     ret
  1552. p_top    endp    
  1553. ;------------------------------------------------------------
  1554. p_bot    proc
  1555.     call    cur_bot
  1556.     mov    cx,60
  1557.     mov    bx,corner
  1558.     add    bx,540
  1559. pb10:    mov    al,buff[bx]
  1560.     call    putchar
  1561.     inc    bx
  1562.     loop    pb10
  1563.     call    pos_c
  1564.     ret
  1565. p_bot    endp
  1566. ;------------------------------------------------------------
  1567. c_up    proc
  1568.     cmp    row,13
  1569.     je    cup10
  1570.     dec    row
  1571.     sub    di,60
  1572.     call    pos_c
  1573.     ret
  1574. cup10:    cmp    corner,0
  1575.     je    cup20
  1576.     call    scroll_dn
  1577.     sub    corner,60
  1578.     sub    di,60
  1579.     call    p_top
  1580. cup20:    ret
  1581. c_up    endp
  1582. ;------------------------------------------------------------
  1583. c_dn    proc
  1584.     cmp    row,22
  1585.     je    cd10
  1586.     inc    row
  1587.     add    di,60
  1588.     call    pos_c
  1589.     ret
  1590. cd10:    cmp    corner,2400
  1591.     je    cd20
  1592.     call    scroll_up
  1593.     add    corner,60
  1594.     add    di,60
  1595.     call    p_bot
  1596. cd20:    ret
  1597. c_dn    endp
  1598. ;------------------------------------------------------------
  1599. c_rt    proc
  1600.     cmp    col,69
  1601.     je    crt10
  1602.     inc    col
  1603.     inc    di
  1604.     call    pos_c
  1605.     ret
  1606. crt10:    cmp    row,22
  1607.     je    crt20
  1608.     mov    col,10
  1609.     inc    row
  1610.     inc    di
  1611.     call    pos_c
  1612.     ret
  1613. crt20:    cmp    corner,2400
  1614.     je    crt30
  1615.     call    scroll_up
  1616.     inc    di
  1617.     add    corner,60
  1618.     mov    col,10
  1619.     call    p_bot
  1620. crt30:    ret
  1621. c_rt    endp
  1622. ;------------------------------------------------------------
  1623. c_lt    proc
  1624.     cmp    col,10
  1625.     je    clt10
  1626.     dec    col
  1627.     dec    di
  1628.     call    pos_c
  1629.     ret
  1630. clt10:    cmp    row,13
  1631.     je    clt20
  1632.     dec    row
  1633.     mov    col,69
  1634.     dec    di
  1635.     call    pos_c
  1636.     ret
  1637. clt20:    cmp    corner,0
  1638.     je    clt30
  1639.     call    scroll_dn
  1640.     mov    col,69
  1641.     dec    di
  1642.     sub    corner,60
  1643.     call    p_top
  1644.     call    pos_c
  1645. clt30:    ret
  1646. c_lt    endp
  1647. ;------------------------------------------------------------
  1648. scroll_up    proc
  1649.     mov    ah,6
  1650.     mov    al,1
  1651.     mov    bh,07
  1652.     mov    ch,13
  1653.     mov    cl,10
  1654.     mov    dh,22
  1655.     mov    dl,69
  1656.     int    10h
  1657.     ret
  1658. scroll_up    endp
  1659. ;------------------------------------------------------------
  1660. scroll_dn    proc
  1661.     mov    ah,07
  1662.     mov    al,1
  1663.     mov    bh,07
  1664.     mov    ch,13
  1665.     mov    cl,10
  1666.     mov    dh,22
  1667.     mov    dl,69
  1668.     int    10h
  1669.     ret
  1670. scroll_dn    endp
  1671. ;------------------------------------------------------------
  1672. putch    proc
  1673.     push    cx
  1674.     mov    ah,10
  1675.     mov    bh,0
  1676.     mov    cx,1
  1677. int    10h
  1678.     pop    cx
  1679.     mov    buff[di],al
  1680.     call    c_rt    
  1681.     ret
  1682. putch    endp
  1683. ;------------------------------------------------------------
  1684. c_bs    proc
  1685.     call    c_lt
  1686.     mov    al,0
  1687.     call    putch
  1688.     call    c_lt
  1689.     ret
  1690. c_bs    endp
  1691. ;------------------------------------------------------------
  1692. crlf    proc
  1693.     mov    dl,69
  1694.     sub    dl,col
  1695.     mov    dh,0
  1696.     add    di,dx
  1697.     mov    col,69
  1698.     call    c_rt
  1699.     ret
  1700. crlf    endp
  1701. ;------------------------------------------------------------
  1702. pos_c    proc
  1703.     push    ax
  1704.     mov    ah,02    ;set cursor
  1705.     mov    bh,00    ;page 0
  1706.     mov    dh,row
  1707.     mov    dl,col
  1708.     int    10h
  1709.     pop    ax
  1710.     ret
  1711. pos_c    endp
  1712. ;------------------------------------------------------------
  1713. s_pad    proc
  1714. ;this is the experimental scratch pad procedure
  1715.     call    cls_b
  1716.     call    window
  1717.     mov    row,13
  1718.     mov    col,10
  1719.     call    pos_c
  1720.     mov    di,0
  1721.     mov    cx,599
  1722.     mov    si,0
  1723. p5:    mov    al,buff[si]
  1724.     call    putch
  1725.     inc    si
  1726.     loop    p5
  1727.     mov    row,13
  1728.     mov    col,10
  1729.     mov    di,0
  1730.     mov    corner,0
  1731.     call    pos_c
  1732. p10:    call    getchar
  1733.     call    strip
  1734.     cmp    ax,0
  1735.     je    p10
  1736.     cmp    al,esc
  1737.     je    p20
  1738.     call    putch
  1739.     jmp    p10
  1740. p20:    ret
  1741. s_pad    endp
  1742. ;------------------------------------------------------------    
  1743. window    proc
  1744.  
  1745. ;
  1746.     mov    ah,02
  1747.     mov    bh,00
  1748.     mov    dh,11    ;row 11
  1749.     mov    dl,6    ;col 6
  1750.     int    10h
  1751. ;
  1752.     lea    dx,w_top
  1753.     mov    ah,09
  1754.     int    21h
  1755. ;
  1756.     mov    temp,12
  1757.     mov    cx,12
  1758. w1:    push    cx
  1759.     mov    ah,02
  1760.     mov    bh,0
  1761.     mov    dh,temp
  1762.     mov    dl,6
  1763.     int    10h
  1764.     mov    al,w_sides
  1765.     call    putchar
  1766.     mov    ah,02
  1767.     mov    bh,00
  1768.     mov    dh,temp
  1769.     mov    dl,72
  1770.     int    10h
  1771.     mov    al,w_sides
  1772.     call    putchar
  1773.     pop    cx
  1774.     inc    temp
  1775.     loop    w1
  1776. ;
  1777.     mov    ah,02
  1778.     mov    bh,00
  1779.     mov    dh,24
  1780.     mov    dl,6
  1781.     int    10h
  1782. ;
  1783.     lea    dx,w_bottom
  1784.     mov    ah,09
  1785.     int    21h
  1786.     call    esd
  1787.     ret
  1788. window    endp
  1789. ;------------------------------------------------------------
  1790. esc_ch    proc
  1791.     push    ax
  1792.     mov    ah,1
  1793.     int    16h
  1794.     jz    nk
  1795.     cmp    al,esc
  1796.     jne    nk
  1797.     pop    ax
  1798.     mov    al,13
  1799.     ret
  1800. nk:    pop    ax
  1801.     ret
  1802. esc_ch    endp
  1803. ;------------------------------------------------------------
  1804. practice    proc
  1805.     call    cls
  1806.     mov    ah,02
  1807.     mov    bh,0
  1808.     mov    dh,0
  1809.     mov    dl,0
  1810.     int 10h
  1811. ;
  1812.     lea    dx,pname
  1813.     mov    ah,09
  1814.     int    21h
  1815.     mov     dx,offset pname2
  1816.     call    loader
  1817.     mov    fail,0
  1818.     call    open2
  1819.     cmp    fail,0ffh
  1820.     je    p_fail
  1821.     call    read2
  1822.     cmp    fail,0ffh
  1823.     je    p_fail
  1824.     call    cls
  1825.     mov    ah,02
  1826.     mov    bh,0
  1827.     mov    dh,0
  1828.     mov    dl,0
  1829.     int    10h
  1830.     mov    cx,pract_num
  1831.     mov    si,0
  1832. pr01:push cx
  1833.     mov    al,b_area[si]
  1834.     push    ax
  1835.     call    putchar
  1836.     pop    ax
  1837.     call    screen
  1838.     inc    si
  1839.     pop    cx
  1840.     loop    pr01
  1841.     call    close2
  1842. p_fail:
  1843.     call    cls
  1844.     call    boxit
  1845.     call heading
  1846.     ret
  1847. practice    endp
  1848. ;------------------------------------------------------------
  1849. open2    proc
  1850.     push    dx
  1851.     push    bx
  1852.     push    ax
  1853.     lea    dx,pr_n
  1854.     mov    bl,pn_len
  1855.     mov    bh,0
  1856.     mov    [pr_n+bx],0
  1857.     mov    al,0
  1858.     mov    ah,3dh
  1859.     int    21h
  1860.     jc    o_fail
  1861.     mov    handle,ax
  1862.     pop    ax
  1863.     pop    bx
  1864.     pop    dx
  1865.     ret
  1866. o_fail:
  1867.     lea    dx,o_err
  1868.     mov    ah,09
  1869.     int    21h
  1870.     mov    cx,30000
  1871. ll:    nop
  1872.     nop
  1873.     loop ll
  1874.     mov    fail,0ffh
  1875.     pop    ax
  1876.     pop    bx
  1877.     pop    dx
  1878.     ret
  1879. open2    endp
  1880. ;------------------------------------------------------------
  1881. read2    proc
  1882.     push    dx
  1883.     push    cx
  1884.     push    bx
  1885.     push    ax
  1886.     mov    bx,handle
  1887.     mov    cx,10000
  1888.     mov    ah,3fh
  1889.     lea    dx,b_area
  1890.     int    21h
  1891.     jc    r_fail
  1892.     mov    pract_num,ax
  1893.     pop    ax
  1894.     pop    bx
  1895.     pop    cx
  1896.     pop    dx
  1897.     ret
  1898. r_fail:
  1899.     lea    dx,r_err
  1900.     mov    ah,09
  1901.     int    21h
  1902.     mov    fail,0ffh
  1903.     pop    ax
  1904.     pop    bx
  1905.     pop    cx
  1906.     pop    dx
  1907.     ret
  1908. read2    endp
  1909. ;------------------------------------------------------------
  1910. close2    proc
  1911.     mov    bx,handle
  1912.     mov    ah, 3eh
  1913.     int    21h
  1914.     ret
  1915. close2    endp
  1916. ;------------------------------------------------------------
  1917. build    proc
  1918.     mov    ah,1
  1919.     int    16h
  1920.     jz    di2
  1921.     mov    ah,0
  1922.     int    16h
  1923.     cmp    al,esc
  1924.     jne    not_e1
  1925.     call    close2
  1926.     mov    ax,abort
  1927.     mov    sp,ax
  1928.     jmp    over2
  1929. not_e1:
  1930.     cmp    al,bs    ;This is test
  1931.     jne    not_bs    ;This is test
  1932.     mov    bx,out_ptr
  1933.     cmp    bx,in_ptr
  1934.     je    di2
  1935.     dec    in_ptr    ;This is test
  1936.     dec    in_ptr    ;This is test
  1937.     jmp    di2    ;This is test
  1938. not_bs:
  1939.  
  1940.     mov    bx,in_ptr
  1941.     mov    big_buf[bx],ax
  1942.     inc    bx
  1943.     inc    bx
  1944.     cmp    bx,512
  1945.     jle    di3
  1946.     mov    bx,0
  1947. di3:
  1948.     mov    in_ptr,bx
  1949. di2:    ret
  1950. build    endp
  1951. ;------------------------------------------------------------
  1952. boxit    proc    
  1953.     mov    ax,0600h    ;scroll
  1954.     mov    bh,70h        ;reverse attribute
  1955.     mov    cx,0017h    ;row 0,column 23
  1956.     mov    dx,0237h    ;to row 2,column 55
  1957.     int    10h
  1958. ;
  1959.     mov    ah,02    ;set cursor
  1960.     mov    bh,00    ;page 0
  1961.     mov    dh,0    ;row 0
  1962.     mov    dl,23    ;column 23
  1963.     int    10h
  1964. ;
  1965.     lea    dx,box_top
  1966.     mov    ah,09
  1967.     int    21h
  1968. ;
  1969.     mov    ah,02    ;set cursor
  1970.     mov    bh,00    ;page 0
  1971.     mov    dh,1    ;row 1
  1972.     mov    dl,23    ;column 23
  1973.     int    10h
  1974. ;
  1975.     lea    dx,box_sides
  1976.     mov    ah,09
  1977.     int    21h
  1978. ;
  1979.     mov    ah,02    ;set cursor
  1980.     mov    bh,00    ;page 0
  1981.     mov    dh,2    ;row 2
  1982.     mov    dl,23    ;column 23
  1983.     int    10h
  1984. ;
  1985.     lea    dx,box_bottom
  1986.     mov    ah,09
  1987.     int    21h
  1988. ;
  1989.     ret
  1990. boxit    endp
  1991. ;------------------------------------------------------------
  1992. heading    proc
  1993.     mov    ah,02    ;set cursor
  1994.     mov    bh,00    ;page 0
  1995.     mov    dh,01    ;row 1
  1996.     mov    dl,29    ;column 29
  1997.     int    10h
  1998. ;    
  1999.     lea    dx,mess1    ;WB8BIL CODE GENERATOR
  2000.     mov    ah,09
  2001.     int    21h
  2002. ;
  2003.     mov    ah,02
  2004.     mov    bh,00
  2005.     mov    dh,3
  2006.     mov    dl,12
  2007.     int    10h
  2008. ;
  2009.     lea    dx,mess6    ;(c) 1985, Gregg Anderson
  2010.     mov    ah,09
  2011.     int    21h
  2012. ;
  2013.     mov    ah,02
  2014.     mov    bh,00
  2015.     mov    dh,05
  2016.     mov    dl,40
  2017.     int    10h
  2018. ;
  2019.     lea    dx,mess2    ;WRITTEN BY
  2020.     mov    ah,09
  2021.     int    21h
  2022. ;
  2023.     mov    ah,02
  2024.     mov    bh,00
  2025.     mov    dh,07
  2026.     mov    dl,45
  2027.     int    10h
  2028. ;
  2029.     lea    dx,mess3    ;GREGG C. ANDERSON
  2030.     mov    ah,09
  2031.     int    21h
  2032. ;
  2033.     mov    ah,02
  2034.     mov    bh,00
  2035.     mov    dh,08
  2036.     mov    dl,45
  2037.     int    10h
  2038. ;
  2039.     lea    dx,mess4    ;247 HILL ST.
  2040.     mov    ah,09
  2041.     int    21h
  2042. ;
  2043.     mov    ah,02
  2044.     mov    bh,00
  2045.     mov    dh,09
  2046.     mov    dl,45
  2047.     int    10h
  2048. ;
  2049.     lea    dx,mess5    ;ISHPEMING, MI 49849
  2050.     mov    ah,09
  2051.     int    21h
  2052.     ret
  2053. heading    endp
  2054. ;------------------------------------------------------------
  2055. b_area        db    10000 dup(?)
  2056. ;------------------------------------------------------------
  2057. codes    ends
  2058. ;************************************************************
  2059.     end    start
  2060.